package com.webdrider.security.exceptions;

import com.common.security.abstracts.AbstractException;

/**
 * Error code range: 1141 - 1160
 * 
 * @author Ady
 *
 */
public class SnippetException extends AbstractException {
	private static final long serialVersionUID = 1L;
	
	public static final int ARTICLE_NOT_FOUND = 1141;
	private static final String MESSAGE_ARTICLE_NOT_FOUND = "The article with the provided data was not found";
	
	public static final int MULTIPLE_ARTICLES_FOUND = 1142;
	private static final String MESSAGE_MULTIPLE_ARTICLES_FOUND = "More than one article was found with the provided data";
	
	public static final int DOMAIN_NOT_FOUND = 1143;
	private static final String MESSAGE_DOMAIN_NOT_FOUND = "The domain with the provided data was not found";
	
	public static final int MULTIPLE_DOMAINS_FOUND = 1144;
	private static final String MESSAGE_MULTIPLE_DOMAINS_FOUND = "More than one domain was found with the provided data";
	
	public static final int TAG_NOT_FOUND = 1145;
	private static final String MESSAGE_TAG_NOT_FOUND = "The tag with the provided data was found";
	
	public static final int MULTIPLE_TAGS_FOUND = 1146;
	private static final String MESSAGE_MULTIPLE_TAGS_FOUND = "More than one tag was found with the provided data";
	
	public SnippetException(int code) {
		super(code, getMessage(code));
	}

	private static String getMessage(int code) {
		switch (code) {
			case ARTICLE_NOT_FOUND: {
				return MESSAGE_ARTICLE_NOT_FOUND;
			}
			case MULTIPLE_ARTICLES_FOUND: {
				return MESSAGE_MULTIPLE_ARTICLES_FOUND;
			}
			case DOMAIN_NOT_FOUND: {
				return MESSAGE_DOMAIN_NOT_FOUND;
			}
			case MULTIPLE_DOMAINS_FOUND: {
				return MESSAGE_MULTIPLE_DOMAINS_FOUND;
			}
			case TAG_NOT_FOUND: {
				return MESSAGE_TAG_NOT_FOUND;
			}
			case MULTIPLE_TAGS_FOUND: {
				return MESSAGE_MULTIPLE_TAGS_FOUND;
			}
			default: {
				return MESSAGE_ERROR_NOT_FOUND;
			}
		}
	}
}
